{{template "layout/layout_admin.html" .}}

{{define "style"}}

{{end}}

{{define "content"}}
<div class="layui-fluid main" style="margin:15px;">

    <fieldset class="layui-elem-field layui-field-title" style="margin-top:20px;">
        <legend>添加发送邮箱</legend>
    </fieldset>


    <form class="layui-form" method="post" action="{{urlfor "MailController.MailEditDo"}}">
        <div class="layui-form-item">
            <label class="layui-form-label">发件箱名称</label>
            <div class="layui-input-block" style="width:280px;">
                <input type="hidden" name="id" value="{{.info.Id}}">
                <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="填写发件箱名称" class="layui-input" value="{{.info.Name}}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">SMTP 地址</label>
            <div class="layui-input-block" style="width:280px;">
                <input type="text" name="mail_host" lay-verify="required" autocomplete="off" placeholder="填写 SMTP 地址" class="layui-input" value="{{.info.Mail_host}}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">邮箱端口</label>
            <div class="layui-input-block" style="width:280px;">
                <input type="text" name="mail_port" lay-verify="required" autocomplete="off" placeholder="填写邮箱端口" class="layui-input" value="{{.info.Mail_port}}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">邮箱帐号</label>
            <div class="layui-input-block" style="width:280px;">
                <input type="text" name="account" lay-verify="required" autocomplete="off" placeholder="填写邮箱帐号" class="layui-input" value="{{.info.Account}}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">邮箱密码</label>
            <div class="layui-input-block" style="width:280px;">
                <input type="text" name="password" lay-verify="" autocomplete="off" placeholder="******" class="layui-input" value="">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">加密方式</label>
            <div class="layui-input-block" style="width:280px;">
                <select name="mail_secure">
                    <option value="">不加密</option>
                    <option value="ssl" {{if eq .info.Mail_secure "ssl"}}selected{{end}}>SSL</option>
                    <option value="tls" {{if eq .info.Mail_secure "tls"}}selected{{end}}>TLS</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">说明</label>
            <div class="layui-input-block"  style="width:480px;">
                <textarea name="desc" class="layui-textarea" >{{.info.Desc}}</textarea>
            </div>
        </div>


        <div class="layui-form-item" style="margin-top:50px;">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="formSubmit">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary" onclick="javascript:history.back();">返回</button>
            </div>
        </div>
    </form>

</div>
{{end}}
{{define "script"}}
<script>
    layui.use(['form', 'laydate','upload','element','table'], function() {
    {{template "layout/baseJs.html" .}}
        var form = layui.form
                ,layer = layui.layer
                ,laydate = layui.laydate
                ,element = layui.element
                ,$ = layui.jquery
                ,table = layui.table;




        form.on('submit(formSubmit)', function(data){
            var url = $(data.form).attr('action');
            var params = $(data.form).serialize();
            QI.ajaxForm(url, params);
            return false;
        });



    });
</script>
{{end}}